#include <bits/stdc++.h>

using namespace std;

class Solution
{
public:
    int numJewelsInStones(string jewels, string stones)
    {
        int ret = 0;
        unordered_set<char> s;
        for (auto e : jewels)
        {
            s.insert(e);
        }
        for (auto e : stones)
        {
            if (s.find(e) != s.end())
            {
                ++ret;
            }
        }
        return ret;
    }
};